﻿@{
    Layout = null;
}
@model GN.Pay.Application.TradeApp.Dto.Output.PayApplyOutput
<!DOCTYPE html>
<HTML>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="~/Content/pay/core.css" rel="stylesheet" />
    <link href="~/Scripts/sweetalert/sweet-alert.css" rel="stylesheet" />
    <link href="~/Content/pay/payfor.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-2.1.4.min.js"></script>
    <script src="~/Scripts/jquery.signalR-2.2.1.js"></script>
    <script src="~/Scripts/sweetalert/sweet-alert.min.js"></script>
    @*<script src="~/Scripts/cashie/paygate.js"></script>*@
    <title>贵农收银台</title>
</head>
<body>
    <div class="gn_payfor_content">
        <input type="hidden" id="applyId" name="orderNo" value="@Model.ApplyId" />
        <div class="gn_payfor_top clearfix">
            <img class="left" src="~/Content/pay/img/logo.jpg" />
            <p class="left">贵农收银台</p>
            <img class="right" src="/Content/pay/img/step3.jpg" />
        </div>
        <div class="gn_payfor_detail">
            <div class="gn_payfor_detai_title">
                @Model.ExpireMessage()
            </div>
            <ul class="gn_payfor_list1 clearfix">
                <li class="pl51" style="width: 30%;">订单</li>
                <li style="width: 50%;">订单名称</li>
                <li style="18%">订单金额</li>
            </ul>
            <ul class="gn_payfor_list2 clearfix">
                <li class="pl51" style="width: 30%;">@Model.OrderNo</li>
                <li style="width: 50%;">@Model.Subject @Model.Body</li>
                <li style="18%">¥ @Model.OrderMoney.ToString("N2")</li>
            </ul>
        </div>
        <div class="gn_payfor_payment">
            <div class="clearfix">
                <a id="gn_payfor_kj" class="gn_payfor_active" href="javascript:;">网银支付</a>
                <a id="gn_payfor_three" href="javascript:;">第三方支付</a>
            </div>
            <div class="gn_payfor_border">
                <div id="gn_payfor_kj_block" class="gn_payfor_choose">
                    <p>温馨提示：需开通网上银行</p>
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="GyccbWebPay" value="Gyb.WebPay" />
                            <label class="gn_payfor_icon left GYDB" for="GyccbWebPay"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="ABC" value="Union.WebPay" />
                            <label class="gn_payfor_icon left ABC" for="ABC"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="BCOM" value="Union.WebPay" />
                            <label class="gn_payfor_icon left BCOM" for="BCOM"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="BEA" value="Union.WebPay" />
                            <label class="gn_payfor_icon left BEA" for="BEA"></label>
                        </li>
                    </ul>
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="BOB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left BOB" for="BOB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="BOC" value="Union.WebPay" />
                            <label class="gn_payfor_icon left BOC" for="BOC"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CBHB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CBHB" for="CBHB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CCB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CCB" for="CCB"></label>
                        </li>
                    </ul>
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CEB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CEB" for="CEB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CIB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CIB" for="CIB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CITIC" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CITIC" for="CITIC"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CMB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CMB" for="CMB"></label>
                        </li>
                    </ul>
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CMBC" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CMBC" for="CMBC"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="CZB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left CZB" for="CZB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="GDB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left GDB" for="GDB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="ICBC" value="Union.WebPay" />
                            <label class="gn_payfor_icon left ICBC" for="ICBC"></label>
                        </li>
                    </ul>
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="NBCB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left NBCB" for="NBCB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="NJCB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left NJCB" for="NJCB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="PAB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left PAB" for="PAB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="SDB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left SDB" for="SDB"></label>
                        </li>
                    </ul>
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="SHB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left SHB" for="SHB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="SPDB" value="Union.WebPay" />
                            <label class="gn_payfor_icon left SPDB" for="SPDB"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="PSBC" value="Union.WebPay" />
                            <label class="gn_payfor_icon left PSBC" for="PSBC"></label>
                        </li>
                    </ul>
                </div>
                <div id="gn_payfor_three_block" class="gn_payfor_choose gn_payfor_three" style="display: none;">
                    <ul class="g-list-4 clearfix">
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="AliPayTransfer" value="AliPay.Transfer" />
                            <label class="gn_payfor_icon left ZFBD" for="AliPayTransfer"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="WeiXinQRCode" value="WeiXin.QRCode" />
                            <label class="gn_payfor_icon left WXBD" for="WeiXinQRCode"></label>
                        </li>
                        <li class="left">
                            <input class="left" type="radio" name="requestUrl" id="YJPayWebPay" value="YJPay.WebPay" />
                            <label class="gn_payfor_icon left YJBD" for="YJPayWebPay"></label>
                        </li>
                    </ul>
                </div>
                <div class="gn_payfor_bottom">
                    <div class="clearfix">
                        <a id="pay" class="left" href="javascript:;">确认支付</a>
                        @*<p class="left">商品总件数<span>2</span>件</p>*@
                        <p class="right">支付总金额: <span>¥ @Model.OrderMoney.ToString("N2")</span>元</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        
        $("#pay").click(function () {
            var channelId = $('input[name=requestUrl]:checked').val();
            if (channelId == undefined || channelId == '') {
                swal("选择一种支付方式", "提示", "error");
            }
            else {
                var applyId = $("#applyId").val();
                var url = "/Cashie/PayChannel/?applyId=" + applyId + "&channelId=" + channelId;
                openwin(url);               
            }
        });


        function openwin(url) {
            var a = document.createElement("a");
            a.setAttribute("href", url);
            a.setAttribute("target", "_blank");
            a.setAttribute("id", "openwin");
            document.body.appendChild(a);
            a.click();
        }

        $("#gn_payfor_kj").click(function () {
            $(this).parent().parent().find("#gn_payfor_three_block").css('display', 'none');
            $(this).parent().parent().find("#gn_payfor_kj_block").css('display', 'block');
            $("#gn_payfor_three").removeClass("gn_payfor_active");
            $("#gn_payfor_kj").addClass("gn_payfor_active");
            $('input[name=requestUrl]:checked').prop('checked', false);
        });
        $("#gn_payfor_three").click(function () {
            $(this).parent().parent().find("#gn_payfor_three_block").css('display', 'block');
            $(this).parent().parent().find("#gn_payfor_kj_block").css('display', 'none');
            $("#gn_payfor_kj").removeClass("gn_payfor_active");
            $("#gn_payfor_three").addClass("gn_payfor_active");
            $('input[name=requestUrl]:checked').prop('checked', false);
        });
        $(function () {
            $("input[type='radio']").click(function () {
                $('.gn_payfor_icon').removeClass("active");
                if ($(this).parent().find(".gn_payfor_icon")) {
                    $(this).parent().find(".gn_payfor_icon").addClass("active");
                }
            })
        });

        var connection = $.hubConnection();
        var notifyProxy = connection.createHubProxy('notifyHub');
        notifyProxy.on('notify', function (msg) {
            location.href = 'http://www.guinong360.com';
        });
        connection.start().done(function () {
            notifyProxy.invoke('registerApply', ($('#applyId').val()));
        });

    </script>
</body>
</HTML>